Fix DockerCompose@1 task to support --profile global flag correctly #21197
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The DockerCompose@1 task was failing when using the
--profile
argument because it was placing global Docker Compose flags in the wrong position in the command line.Problem
When users specified
--profile
in the arguments field:The task generated this command:
This fails with
unknown flag: --profile
because--profile
is a global Docker Compose flag that must be placed before the command, not after it.Solution
This PR implements argument parsing that correctly separates global Docker Compose flags from command-specific flags:
Added
parseComposeArguments()
function indockercomposeutils.ts
that identifies global flags (--profile
,--ansi
,--compatibility
,--dry-run
,--env-file
,--parallel
,--progress
,--project-directory
) and separates them from command-specific arguments.Updated
createComposeCommand()
indockercomposeconnection.ts
to accept global arguments and place them in the correct position:docker compose [global-flags] [file-flags] [project] [command] [command-args]
.Modified all action modules (
dockercomposebuild.ts
,dockercomposerun.ts
,dockercomposeup.ts
,dockercomposecommand.ts
) to use the new argument parsing logic.Result
The same configuration now generates the correct command:
This fix is backward compatible and handles various argument formats including
--flag value
,--flag=value
, and quoted arguments.Testing
Fixes #21150.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
03nvsblobprodwcus014.vsblob.vsassets.io
npm install
(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js
(dns block)055vsblobprodwcus02.vsblob.vsassets.io
npm install
(dns block)1g1vsblobprodwcus01.vsblob.vsassets.io
npm install
(dns block)3eavsblobprodwcus03.vsblob.vsassets.io
npm install
(dns block)3zgvsblobprodwcus024.vsblob.vsassets.io
npm install
(dns block)40qvsblobprodwcus022.vsblob.vsassets.io
npm install
(dns block)4fdvsblobprodwcus012.vsblob.vsassets.io
npm install
(dns block)5tbvsblobprodwcus06.vsblob.vsassets.io
npm install
(dns block)61cvsblobprodwcus010.vsblob.vsassets.io
npm install
(dns block)73dvsblobprodwcus07.vsblob.vsassets.io
npm install
(dns block)8usvsblobprodwcus011.vsblob.vsassets.io
npm install
(dns block)9owvsblobprodwcus020.vsblob.vsassets.io
npm install
(dns block)arpvsblobprodwcus017.vsblob.vsassets.io
npm install
(dns block)crcvsblobprodwcus021.vsblob.vsassets.io
npm install
(dns block)fslvsblobprodwcus015.vsblob.vsassets.io
npm install
(dns block)grnvsblobprodwcus04.vsblob.vsassets.io
npm install
(dns block)k92vsblobprodwcus08.vsblob.vsassets.io
npm install
(dns block)mnzvsblobprodwcus05.vsblob.vsassets.io
npm install
(dns block)pl8vsblobprodwcus09.vsblob.vsassets.io
npm install
(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js
(dns block)uubvsblobprodwcus018.vsblob.vsassets.io
npm install
(dns block)vwmvsblobprodwcus016.vsblob.vsassets.io
npm install
(dns block)x4wvsblobprodwcus013.vsblob.vsassets.io
npm install
(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js
(dns block)xg1vsblobprodwcus019.vsblob.vsassets.io
npm install
(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js
(dns block)xlkvsblobprodwcus023.vsblob.vsassets.io
npm install
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.